package com.awa.usercenter.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 通用返回类
 *
 * @param <T>
 */
@Accessors(chain = true)
@Data
@NoArgsConstructor
public class BaseResponse<T> implements Serializable {

    private int code;

    private T data;

    private String message;

    private String description;

    public BaseResponse(int code, T data, String message,String description){
        this.code = code;
        this.data = data;
        this.message = message;
        this.description = description;
    }
    public BaseResponse(int code, T data, String message){
        this(code, data, message, "");
    }

    public BaseResponse(int code, T data)
    {
        this(code, data, "message", "");
    }

    public BaseResponse(Code code){
        this(code.getCode(), null, code.getMessage(), code.getDescription());
    }
}
